/*
 * @Author: byron
 * @Date: 2021-09-18 17:21:38
 * @LastEditTime: 2021-09-18 19:07:37
 */
import React, { Component } from "react";
import axios from "axios";

export default class App extends Component {
  getData = () => {
    axios.get("http://localhost:3000/api1/students").then(
      (res) => {
        console.log("success");
        console.log(res);
      },
      (err) => {
        console.log("err");
      }
    );
  };
  getDataCar = () => {
    axios.get("http://localhost:3000/api2/cars").then(
      (res) => {
        console.log("success");
        console.log(res);
      },
      (err) => {
        console.log("err");
      }
    );
  };

  render() {
    return (
      <div>
        <button onClick={this.getData}>点我发送请求</button>
        <button onClick={this.getDataCar}>点我发送请求(汽车)</button>
      </div>
    );
  }
}
